#include <bits/stdc++.h>
using namespace std;
long long i[10000000];
long long u[1111111];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a, b, c, d = 0, e = 0, f = 0, g = 0;
  cin >> a >> b >> i[0];
  if (i[0] % b == 0) d++;
  for (int n = 1; n < a; n++) {
    cin >> c, i[n] = i[n - 1] + c;
    if (i[n] % b == 0) d++;
  }
  for (int n = 0; n < a; n++) {
    for (int m = n + 1; m < a; m++) {
      if ((i[m] - i[n]) % b == 0) d++;
    }
  }
  cout << d << '\n';
  return (0);
}
