#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
vector<int> prefix_function(vector<int> s) {
  int n = s.size();
  vector<int> pi(n);
  pi[0] = 0;
  for (int i = 1; i < n; ++i) {
    int j = pi[i - 1];
    while (j > 0 && s[i] != s[j]) {
      j = pi[j - 1];
    }
    if (s[i] == s[j]) {
      ++j;
    }
    pi[i] = j;
  }
  return pi;
}
vector<int> res_vector(vector<int> s, vector<int> t) {
  vector<int> res = s;
  res.push_back(2 * INF);
  for (int i = 0; i < t.size(); ++i) {
    res.push_back(t[i]);
  }
  return res;
}
vector<int> process(vector<int> res, vector<int> pi, int n) {
  vector<int> ans(res.size());
  for (int i = n + 1; i < res.size(); ++i) {
    ++ans[pi[i]];
  }
  for (int i = res.size() - 1; i >= n + 1; --i) {
    ans[pi[i - 1]] += ans[i];
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  int n, w;
  cin >> n >> w;
  if (w == 1) {
    cout << n << endl;
    return 0;
  }
  vector<int> a(n - 1);
  int last;
  cin >> last;
  for (int i = 0; i < n - 1; ++i) {
    int temp;
    cin >> temp;
    a[i] = temp - last;
    last = temp;
  }
  cin >> last;
  vector<int> b(w - 1);
  for (int i = 0; i < w - 1; ++i) {
    int temp;
    cin >> temp;
    b[i] = temp - last;
    last = temp;
  }
  vector<int> res = res_vector(b, a);
  vector<int> pi = prefix_function(res);
  vector<int> ans = process(res, pi, b.size());
  cout << ans[w - 1] << endl;
  return 0;
}
