#include <bits/stdc++.h>   using namespace std;   signed solve();   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     int tests = 1;     while (tests--) solve();     return 0;   }   signed solve() {     int n, k;     cin >> n >> k;     if (n <= 1ll * k * (k - 1)) {       cout <<  YES n ;       for (int i = 0; i < n; ++i) {         cout << (i % k) + 1 <<     << (i / k + i % k + 1) % k + 1 <<   n ;       }     } else {       cout <<  NO n ;     }     return 0;   }   