https://www.acmicpc.net/problem/1449
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX = 1000;
int n, l; // 개수, 길이
int tape[MAX];
// 수리공 항승
int solution(){
int answer = 1;
sort(tape, tape+n);
int t = tape[0];
for(int i=1;i<n;i++){
if(tape[i] <= t + l-1)
continue;
else{
t = tape[i];
answer++;
}
}
return answer;
}
#include <stdio.h>
#include <algorithm>
int main(void) {
int N, K, cnt = 0;
scanf("%d %d", &N, &K);
int pos[N], pos_check = 0;
for(int i = 0; i < N; i++) {
scanf("%d", &pos[i]);
}
std::sort(pos, pos+N);
for(int i = 0; i < N; i++) {
if(pos_check < pos[i]){
pos_check = pos[i] + K - 1;
cnt++;
}
}
printf("%d", cnt);
return 0;
}