#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[n + 1], b[n + 1];
  b[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = b[i - 1] + a[i];
  }
  long long count = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if ((b[j] - b[i - 1]) % m == 0) count += 1;
    }
  }
  cout << count << endl;
  return 0;
}
