#include <bits/stdc++.h>
using namespace std;
long long int n, k;
pair<int, int> a[200005];
int main() {
  cin >> n >> k;
  if (n > k * (k - 1))
    cout << "No" << endl;
  else {
    cout << "Yes" << endl;
    long long int itr = 0;
    long long int t = 1, tt = 2;
    for (int i = 0; i < n; i += 2) {
      a[i].first = t;
      a[i].second = tt;
      a[i + 1].first = tt;
      a[i + 1].second = t;
      itr++;
      if (itr == k - t) {
        t++;
        tt = t;
        itr = 0;
      }
      tt++;
    }
    for (int i = 0; i < n; i++)
      cout << a[i].first << " " << a[i].second << endl;
  }
  return 0;
}
