#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, M, num, ans(0), sum(0);
  vector<long long> v;
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    cin >> num;
    v.push_back(num);
  }
  for (int i = 0; i < N; i++) {
    for (int k = 0; (k + i) < N; k++) {
      for (int j = k; (j + i) < N; j++) {
        sum += v[j] % M;
      }
      if (sum % M == 0) {
        ans++;
      }
      sum = 0;
    }
  }
  cout << ans;
}
