#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const double E = 1e-7;
const long long INF = 1e16;
using namespace std;
const double EPS = 1e-9;
int inf = 1e9 + 7;
int main() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int> > v;
  for (int a = 1; a < k; a++) {
    for (int b = a + 1; b <= k; b++) {
      v.push_back(make_pair(a, b));
      v.push_back(make_pair(b, a));
      if (v.size() >= n) {
        cout << "yes\n";
        for (int i = 0; i < n; i++) {
          cout << v[i].first << " " << v[i].second << "\n";
        }
        return 0;
      }
    }
  }
  cout << "no";
  return 0;
}
