#include using namespace std; int main(){ int n, k, v, ans = 0; cin >> n >> k; vector dp(390625), dp2(390625); for(int i = 0; i < n; i++){ string s; cin >> s; dp[v] = dp2[v = stoi(s, nullptr, 5)] = true; } for(int i = 390624; i >= 0; i--){ if(!dp2[i])continue; ans += dp[i]; for(int j = 0, d = 1; j < k; j++, d *= 5){ if(i / d % 5){ dp2[i - d] = true; dp[i - d] = false; } } } cout << n - ans << '\n'; }