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