#include <bits/stdc++.h>   using namespace std;   unsigned long long n, k, b1, b2, b[200007], ans, dl, dll[200007], an[200007];   map<unsigned long long, unsigned long long> a[11];   int main() {     ios::sync_with_stdio(0);     cout.tie(0);     cin.tie(0);     cin >> n >> k;     for (unsigned long long i = 1; i <= n; i++) {       cin >> b[i];       b1 = b[i];       dl = 0;       while (b1 > 0) {         dl++;         b1 = b1 / 10;       }       dll[i] = dl;       b1 = b[i];       a[dl][b[i] % k]++;     }     for (unsigned long long i = 1; i <= n; i++) {       b1 = 1;       for (unsigned long long j = 1; j <= 10; j++) {         b1 *= 10;         b2 = b[i] * b1;         b2 %= k;         b2 = k - b2;         if (b2 == k) b2 = 0;         if (a[j].find(b2) != a[j].end()) {           ans += a[j][b2];           if (dll[i] == j && b2 == b[i] % k) ans--;         }       }     }     cout << ans;   }   