#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m;
vector<vector<int>> g;
vector<int> p;
void s(int v, int num) {
  if (p[v] == -1)
    p[v] = num;
  else
    return;
  for (auto vv : g[v]) {
    s(vv, num);
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  set<int> num;
  vector<int> len(300010);
  num.insert(a[0]);
  len[a[0]] = 1;
  for (int i = 1; i < n; i++) {
    for (auto j : num) {
      if (abs(a[i] - j) <= k) {
        len[a[i]] = max(len[a[i]], len[j] + 1);
      }
    }
    num.insert(a[i]);
    len[a[i]] = max(1, len[a[i]]);
  }
  int ans = 0;
  for (int i = 0; i < 300010; i++) {
    ans = max(ans, len[i]);
  }
  cout << len[9] << endl;
  cout << ans << endl;
}
