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