#include <bits/stdc++.h>
using namespace std;
void showStr(string str) { cout << str << endl; }
void showInt(int num) { cout << num << endl; }
void showAB(bool isA, string a, string b) {
  if (isA) {
    cout << a << endl;
  } else {
    cout << b << endl;
  }
}
void showYesNo(bool isYes) { showAB(isYes, "Yes", "No"); }
void showYES_NO(bool isYES) { showAB(isYES, "YES", "NO"); }
int getInputToInt() {
  int a;
  cin >> a;
  return a;
}
string getInputToStr() {
  string str;
  cin >> str;
  return str;
}
int main() {
  int n = getInputToInt();
  int m = getInputToInt();
  vector<int> v(n);
  for (size_t i = 0; i < n; i++) {
    v[i] = getInputToInt();
  }
  int ans = 0;
  int buf = 0;
  for (size_t i = 0; i < n; i++) {
    for (size_t j = i; j < n; j++) {
      buf = (buf + v[j]) % m;
      if (buf == 0) {
        ans++;
      }
    }
    buf = 0;
  }
  showInt(ans);
  return 0;
}
