#include "bits/stdc++.h"
#pragma GCC optimize("unroll-loops", "Ofast")
using namespace std;
#define ll long long
const int inf = 2e9;
const ll INF = 2e18;

//#define int ll
#include "ext/pb_ds/assoc_container.hpp"
using namespace __gnu_pbds;
typedef tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;

random_device dev;
mt19937 rnd(dev());

template<typename T1, typename T2>
istream& operator >> (istream &in, pair<T1, T2> &a) {
    in >> a.first >> a.second;
    return in;
}

template<typename T1, typename T2>
ostream& operator << (ostream &out, pair<T1, T2> &a) {
    out << a.first << " " << a.second;
    return out;
}

template<typename T>
istream& operator >> (istream &in, vector<T> &a) {
    for (int i = 0; i < a.size(); i++)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator << (ostream &out, vector<T> &a) {
    for (auto &i: a)
        cout << i << " ";
    return out;
}

template<typename T>
T msMx(multiset<T> &ms) {
    auto it = ms.end();
    it--;
    return *it;
}

const ll MOD = 1e9 + 7;

ll modPw(ll a, ll n) {
    ll res = 1;
    for (; n > 0; n /= 2, a = (a * a) % MOD) {
        if (n & 1)
            res = (res * a) % MOD;
    }
    return res;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    cout << m - 1 << "\n";
    cout << modPw(2, m) - 1 << "\n";
}
