#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
const int MAXN = 1e5 + 5;
const int MAXM = 1e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const ll LLINF = 2e18;
const ld EPS = 1e-9;
int m, n, k, ans, cnt, x, y, l, r;
string s;
int a[MAXN], b[MAXN], pref[MAXN];
set<int> pref_set, ans_set, b_set, b_set2;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> k >> n;
  int sum = 0;
  for (int i = 0; i < k; i++) {
    cin >> a[i];
    sum += a[i];
    pref[i] = sum;
    pref_set.insert(sum);
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    b_set.insert(b[i]);
  }
  b_set2 = b_set;
  for (int i = 0; i < k + 1; i++) {
    int beg;
    if (i == 0) {
      beg = b[0];
    } else {
      beg = b[0] - pref[i - 1];
    }
    if (ans_set.count(beg) == 0) {
      for (int i = 0; i < k; i++) {
        if (b_set.count(beg + pref[i])) {
          b_set.erase(beg + pref[i]);
        }
      }
      if (((int)(b_set).size()) == 0) {
        ans_set.insert(beg);
      }
      b_set = b_set2;
    }
  }
  cout << ((int)(ans_set).size()) << '\n';
  return 0;
}
