#include <iostream>
#include<set>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
int n,k;
cin>>n>>k;
vector<int> a(n);
for(int i =0; i<n; ++i) cin>>a[i];
sort(a.begin(),a.end());
set<int> used;
for(int i = 0; i<n; ++i)
if(a[i]%k!=0 || !used.count(a[i]/k))
used.insert(a[i]);
cout << used.size();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZTxzZXQ+CiNpbmNsdWRlPGFsZ29yaXRobT4KI2luY2x1ZGU8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKQp7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGludCBuLGs7CiAgICBjaW4+Pm4+Pms7CiAgICB2ZWN0b3I8aW50PiBhKG4pOwogICAgZm9yKGludCBpID0wOyBpPG47ICsraSkgY2luPj5hW2ldOwogICAgc29ydChhLmJlZ2luKCksYS5lbmQoKSk7CiAgICBzZXQ8aW50PiB1c2VkOwogICAgZm9yKGludCBpID0gMDsgaTxuOyArK2kpCiAgICAgICAgaWYoYVtpXSVrIT0wIHx8ICF1c2VkLmNvdW50KGFbaV0vaykpCiAgICAgICAgICAgIHVzZWQuaW5zZXJ0KGFbaV0pOwogICAgY291dCA8PCB1c2VkLnNpemUoKTsKCn0K