1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 #include<cmath>
5 #include<algorithm>
6 #include<map>
7 using namespace std;
8 void read(int &n)
9 {
10 char c='+';int x=0;bool flag=0;
11 while(c<'0'||c>'9')
12 {c=getchar();if(c=='-')flag=1;}
13 while(c>='0'&&c<='9')
14 {x=x*10+(c-48);c=getchar();}
15 flag==1?n=-x:n=x;
16 }
17 int n;
18 int a[1000001];
19 int comp(int a,int b)
20 {
21 return a<b;
22 }
23 //int hash[10000001];
24 map<int,bool>hash;
25 int main()
26 {
27 int p;
28 read(n);
29 read(p);
30 for(int i=1;i<=n;i++)
31 read(a[i]);
32 int ans=0;
33 sort(a+1,a+n+1,comp);
34 for(int i=1;i<=n;i++)
35 {
36 if(hash[a[i]]==0)
37 {
38 hash[a[i]*p]=1;
39 ans++;
40 }
41 }
42 printf("%d",ans);
43 return 0;
44 }