#include #pragma GCC optimize("Ofast") using namespace std; typedef long double ld; typedef long long int ll; typedef unsigned long long int ull; typedef vector vi; typedef vector vc; typedef vector vb; typedef vector vd; typedef vector vs; typedef vector vll; typedef vector > vpii; typedef vector > vvi; typedef vector > vvc; typedef vector > vvs; typedef vector > vvll; typedef vector > vvb; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define mes(a) cout << (a) << endl #define dmes(a, b) cout << (a) << " " << (b) << endl #define CHOOSE(a) CHOOSE2 a #define CHOOSE2(a0,a1,a2,a3,a4,x,...) x #define debug_1(x1) cout<<#x1<<": "< inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } }; const int INF = INT_MAX; const ll LLINF = 1LL << 60; const ll MOD = 1000000007; const double EPS = 1e-9; ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } ll modpow(ll x, ll y) { if(y == 1) { return x; } ll ans; if(y % 2 == 1) { ll r = modpow(x,(y-1)/2); ans = r * r % MOD; ans = ans * x % MOD; } else { ll r = modpow(x,y/2); ans = r * r % MOD; } return ans; } ll modncr(ll N, ll K) { ll res = 1; ll p=1; for (ll n = 0; n < K; ++n) { res = (res*(N - n))%MOD; p = (p*(n + 1))%MOD; } return (res*modpow(p,MOD-2))%MOD; } signed main() { ll s, k; cin >> s >> k; mes(s%k); }