#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const double pi = acos(-1.0);
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  vector<long long> ru(n + 1);
  ru[0] = 0;
  for (int i = 0; i < (n); ++i) ru[i + 1] = ru[i] + a[i];
  long long ans = 0;
  for (int i = 0; i < (n + 1); ++i) {
    for (int j = (i + 1); j < (n + 1); ++j) {
      if ((ru[j] - ru[i]) % m == 0) ans++;
    }
  }
  cout << (ans) << endl;
}
