#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1'000'000'000'000'000'000ll + 7;
//const i64 inf = 1'000'000'007;

const long double eps = 1e-8;

const i64 MAXN = 100'000 + 6;

i64 n, m;
i64 a[MAXN];

vector<pair<i64, i64>> z;
map<pair<i64, i64>, i64> r;

void gen() {
    r.clear();
    for (i64 i = 1; i <= n; i++) {
        a[i] = i;
    }
}

void shift() {
    for (i64 i = 1; i <= n; i++) {
        a[i - 1] = a[i];
    }

    a[n] = a[0];
}

void count() {
    for (auto t : z) {
        pair<i64, i64> p = { min(a[t.first], a[t.second]), max(a[t.first], a[t.second]) };
        r[p] += 1;
    }
}

void solve() {
    if (n % 2) {
        for (i64 i = 1; i <= m; i++) {
            i64 j = 2 * m - i + 1;
            z.push_back({ i, j });
        }
    }
    else {
        i64 l = m / 2 + m % 2;

        for (i64 i = 1; i <= l; i++) {
            i64 j = 2 * l - i + 1;
            z.push_back({ i, j });
        }

        i64 s = 2 * l;
        l -= m % 2;

        for (i64 i = 1; i <= l; i++) {
            i64 j = 2 * l - i + 2;
            z.push_back({ i + s, j + s});
        }
    }
}

bool check() {
    gen();

    for (i64 i = 1; i <= n; i++) {
        count();
        shift();
    }

    for (auto t : r) {
        if (t.second != 1) {
            return false;
        }
    }

    return true;
}

void brute() {
    for (i64 i = 1; i <= n; i++) {
        for (i64 j = i + 1; j <= n; j++) {
            for (i64 x = j + 1; x <= n; x++) {
                for (i64 y = x + 1; y <= n; y++) {
                    for (i64 u = y + 1; u <= n; u++) {
                        for (i64 v = u + 1; v <= n; v++) {
                            z = {
                                { i, j },
                                { x, y },
                                { u, v },
                            };
                            if (check()) {
                                return;
                            }


                            z = {
                                { i, x },
                                { j, y },
                                { u, v },
                            };
                            if (check()) {
                                return;
                            }

                            z = {
                                { i, y },
                                { x, j },
                                { u, v },
                            };
                            if (check()) {
                                return;
                            }



                        }
                    }
                }
            }
        }
    }
}


int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n >> m;

    solve();
    //brute();
    //z = {
    //    {1, 6},
    //    {2, 5},
    //    {3, 4},
    //    {7, 11}
    //};
    //cerr << check() << endl;

    stringstream ss;
    for (auto t : z) {
        ss << t.first << " " << t.second << endl;
    }
    cout << ss.str();


    return 0;
}

Measured memory_bytes: 7672