#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000001;
const int inf = 1000000000;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
struct Road {
  double cost;
  int a, b;
};
int main() {
  long long n, m;
  long long a[100001];
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  long long total = 0, r = 0;
  for (int i = 0; i < n; ++i) {
    r = 0;
    for (int j = i; j < n; j++) {
      if ((r + a[j]) % m == 0) total++;
      r += a[j];
    }
  }
  cout << total << endl;
  return 0;
}
