#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using pss = pair<string, string>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using ll = long long;
using pllll = pair<ll, ll>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vpii = vector<pii>;
using pqi = priority_queue<int>;
using pqd = priority_queue<double>;
using pqll = priority_queue<ll>;
using pqvi = priority_queue<vi>;
using pqvll = priority_queue<vll>;
ll mod = 0;
int main() {
  int n;
  cin >> n >> mod;
  int dp[100001] = {};
  dp[0] = 1;
  int a = 0;
  int s = 0;
  for (int i(0); i < n; ++i) {
    int b;
    cin >> b;
    a += b;
    a %= mod;
    s += dp[a];
    ++dp[a];
  }
  cout << s << endl;
}
