#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long x, y;
long long a[200005], b[200005];
int main() {
  scanf("%lld%lld", &n, &k);
  if (n > k * (k - 1))
    printf("no\n");
  else {
    printf("yes\n");
    a[0] = 1LL;
    b[0] = 2LL;
    a[1] = 2LL;
    b[1] = 1LL;
    x = 1;
    y = 2;
    for (long long i = 2; i < 200000; i += 2) {
      y++;
      if (y > k) {
        x++;
        y = x + 1;
      }
      if (x == a[i - 1] || y == b[i - 1]) {
        a[i] = y;
        b[i] = x;
      } else {
        a[i] = x;
        b[i] = y;
      }
      a[i + 1] = b[i];
      b[i + 1] = a[i];
    }
    for (int i = 0; i < n; i++) {
      printf("%lld %lld\n", a[i], b[i]);
    }
  }
}
