#include <bits/stdc++.h>
using namespace std;
int a[2002], pre[2002];
set<int> S1, S2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int k, n, i, j;
  cin >> k >> n;
  for (i = 0; i < k; i++) {
    cin >> a[i];
    if (i == 0)
      pre[0] = a[0];
    else
      pre[i] = pre[i - 1] + a[i];
  }
  int x;
  for (i = 0; i < n; i++) {
    cin >> x;
    for (j = 0; j < k; j++) {
      if (S1.find(x - pre[j]) != S1.end() || i == 0) S2.insert(x - pre[j]);
    }
    S1 = S2;
    S2.clear();
  }
  cout << S1.size();
}
