#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////////
#define int long long
#define endl "\n"
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define INF 1e18
#define ss second
#define ff first
#define pb push_back
#define ins insert
#define all(a) a.begin() , a.end()
#define input(a , n) for(int i = 0 ; i < n ; i ++) cin >> a[i]
///////////////////////////////////////////////
const int sz = 1e6 + 5 ;
const int LG = 20 ;
const int N = 1e9 + 5 ;
const int mod = 1e9 + 7 ;
const int MAXM = 1e9 + 7 ;
///////////////////////////////////////////////
int lcm(int a , int b) {
return a * b / gcd(a , b) ;
}
///////////////////////////////////////////////
///////////////////////////////////////////////
int LIS(vector < int > &a){
int n = (int)a.size();
vector < int > lis;
for(int i = 0; i < n; i++){
auto it = lower_bound(lis.begin(), lis.end(), a[i]);
if(it == lis.end())
lis.push_back(a[i]);
else
*it = a[i];
}
return (int)lis.size();
}
void solve(){
int n, x;
cin >> n >> x;
vector < int > a(n);
for(int &i : a)cin >> i;
int mx = LIS(a);
for(int i = 0; i < n; i++){
a[i] -= x;
mx = max(mx, LIS(a));
}
cout << mx << endl;
}
signed main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//precompute() ;
IO ;
int t = 1 ;
// cin >> t ;
while(t --) {
solve() ;
cout << endl ;
}
}