#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 7;
int a[N], b[N], n, k;
map<int, int> vis, res, tmp;
void work(int x) {
  tmp.clear();
  int ans = b[1] - a[x];
  for (int i = 1; i <= k; ++i) {
    int haha = ans + a[i];
    tmp[haha] = 1;
  }
  bool flag = true;
  for (auto& x : vis) {
    if (!tmp[x.first]) {
      flag = false;
      break;
    }
  }
  if (flag) res[ans] = 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> k >> n;
  for (int i = 1; i <= k; ++i) cin >> a[i];
  for (int i = 1; i <= k; ++i) a[i] += a[i - 1];
  for (int i = 1; i <= n; ++i) cin >> b[i], vis[b[i]] = 1;
  for (int i = 1; i <= k; ++i) work(i);
  cout << res.size() << endl;
  return 0;
}
