Can this code be improved?

i passed all the test cases but i feel the logic is not the best here. can somone please improve this code?

#include
using namespace std;

int main()
{
int n1,n2;
cin>>n1>>n2;

for(int i=1;i<=n1;i++)
{
	int sum=0;
	sum=(3*i)+2;


	if(sum%n2!=0)
	{
		cout<<sum<<endl;
	}

	else
	{
		n1++;
	}


}

return 0;
}

Hey @ashishxmathew
This is good in terms of complexity .

Other way to write this is

    int n=1;int count=1;
    while(count<=n1){

        int ans=3*n+2;
        if(ans%n2!=0){
            cout<<(ans)<<endl;
            count++;
        }                
        n++;
      }

Complexity of this code is same as urs

while outputting ans here is it important to use () brackets or is it just optional??

Optional
See there can be multiple ways to write the same code. What matters is its complexity both time and space.