#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
long long power(long long a, long long b, long long m = 1000000007) {
  long long ans = 1;
  a = a % m;
  while (b > 0) {
    if (b & 1) ans = (1ll * a * ans) % m;
    b >>= 1;
    a = (1ll * a * a) % m;
  }
  return ans;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
bool cmp(pair<int, int> p1, pair<int, int> p2) { return p1.second > p2.second; }
const int MAXN = 2e5 + 10;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  if ((k) * (k - 1) >= n) {
    cout << "yes"
         << "\n";
    bool al = true;
    vector<pair<long long, long long>> pk(n);
    long long x = k;
    long long shift = 0;
    for (long long i = 0; i < n; i = i + 1) {
      if (i % k == 0) shift++;
      pk[i].first = (i % k) + 1;
      pk[i].second = ((i + k) + shift) % k + 1;
    }
    for (auto i : pk) {
      cout << i.first << " " << i.second << "\n";
    }
  } else {
    cout << "no"
         << "\n";
  }
  return 0;
}
