#include <bits/stdc++.h>
using namespace std;
void FAST() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const long long md = 1000000007;
const long long inf = 1e18L + 5;
const char nl = '\n';
const int N = 200005;
int main() {
  FAST();
  int tt{}, T{};
  tt = 1;
  while (tt--) {
    string str, sa, sb;
    long long n{}, m{}, ans{}, k{}, a{}, b{}, c{}, x{}, y{}, f{}, q{};
    cin >> n >> k;
    if (k * (k - 1) < n) {
      cout << "No" << '\n';
      return 0;
    }
    vector<pair<long long, long long> > v;
    for (long long i = 1; i < k; ++i) {
      for (long long j = i + 1; j < k + 1; ++j) {
        v.push_back({i, j});
        v.push_back({j, i});
        if (v.size() >= n) break;
      }
      if (v.size() >= n) break;
    }
    cout << "Yes" << '\n';
    for (long long i = 0; i < n; ++i)
      cout << v[i].first << " " << v[i].second << nl;
  }
  return 0;
}
