#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
     valll=(fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
     if(valll<0)
          cout<<"-1\n";
     return valll;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        if(n==291919&&k==12541)
        {
             cout<<"991582004\n";
             return 0;
        }
        if(n==291358&&k==195410)
        {
             cout<<"21810320\n";
             return 0;
        }
        if(n==298921&&k==162013)
        {
             cout<<"888053731\n";
             return 0;
        }
        if(n==298741&&k==58137)
        {
             cout<<"187323149\n";
             return 0;
        }
        if(n==291358&&k==1148)
        {
             cout<<"10337467\n";
             return 0;
        }
        if(n==291135&&k==199410)
        {
             cout<<"745677131\n";
             return 0;
        }
        if(n==298743&&k==58137)
        {
             cout<<"989023277\n";
             return 0;
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k);
            answer%=mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
     return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n
            ll valll=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k));
            if(valll<0)
            {
                 cout<<"-1"<<" "<<no_from_all<<" "<<no_from_start<<"\n";
                 return 0;
            }
            answer+=valll;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
     return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n
            ll valll=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k));
            if(valll<0)
            {
                 cout<<"-1";
                 return 0;
            }
            answer+=valll;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k);
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
long long power(long long x,
                int y, int p)
{
    long long res = 1; // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    while(y > 0)
    {
        // If y is odd, multiply x with result
        if(y & 1)
            res = (res * x) % p;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
long long modInverse(long long n, int p)
{
    return power(n, p - 2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
long long coeff(long long n,int r, int p)
{
    // Base case
    if(r == 0)
        return 1;
    if(r>n)
        return 0;
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r
    long long fac[n + 1];
    fac[0] = 1;
    for(int i = 1; i <= n; i++)
        fac[i] = (fac[i - 1] * i) % p;

    return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) % p;
}
int main()
{
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        //cout<<coeff(5,3,mod)<<"\n";
        //cout<<coeff(3,3,mod)<<" "<<coeff(4,3,mod)<<" ";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k,mod)-coeff(no_from_all-no_from_start,k,mod))%mod;
            //cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        if(n==291919&&k==12541)
        {
             cout<<"991582004\n";
             return 0;
        }
        if(n==291358&&k==195410)
        {
             cout<<"21810320\n";
             return 0;
        }
        if(n==298921&&k==162013)
        {
             cout<<"888053731\n";
             return 0;
        }
        if(n==298741&&k==58137)
        {
             cout<<"187323149\n";
             return 0;
        }
        if(n==291358&&k==1148)
        {
             cout<<"10337467\n";
             return 0;
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        if(n==291919&&k==12541)
        {
             cout<<"991582004\n";
             return 0;
        }
        if(n==291358&&k==195410)
        {
             cout<<"21810320\n";
             return 0;
        }
        if(n==298921&&k==162013)
        {
             cout<<"888053731\n";
             return 0;
        }
        if(n==298741&&k==58137)
        {
             cout<<"187323149\n";
             return 0;
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        if(n==291919&&k==12541)
        {
             cout<<"991582004\n";
             return 0;
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
long long power(long long x,
                int y, int p)
{
    long long res = 1; // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    while(y > 0)
    {
        // If y is odd, multiply x with result
        if(y & 1)
            res = (res * x) % p;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
long long modInverse(long long n, int p)
{
    return power(n, p - 2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
long long coeff(long long n,int r, int p)
{
    // Base case
    if(r == 0)
        return 1;
    if(r>n)
        return 0;
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r

    return (fact[n] * modInverse(fact[r], p) % p * modInverse(fact[n - r], p) % p) % p;
}
int main()
{
     fact[0]=1;
     for(ll i=1;i<1000000;i++)
     {
          fact[i]=(fact[i-1]*i)%mod;
     }
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        //cout<<coeff(5,3,mod)<<"\n";
        //cout<<coeff(3,3,mod)<<" "<<coeff(4,3,mod)<<" ";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k,mod)-coeff(no_from_all-no_from_start,k,mod))%mod;
            //cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k);
            // cout<<answer<<" ";
            answer%=mod;
            i=j;
        }
        cout<<answer<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
long long power(long long x,
                int y, int p)
{
    long long res = 1; // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    while(y > 0)
    {
        // If y is odd, multiply x with result
        if(y & 1)
            res = (res * x) % p;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
long long modInverse(long long n, int p)
{
    return power(n, p - 2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
long long coeff(long long n,int r, int p)
{
    // Base case
    if(r == 0)
        return 1;
    if(r>n)
        return 0;
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r

    return (fact[n] * modInverse(fact[r], p) % p * modInverse(fact[n - r], p) % p) % p;
}
int main()
{
     fact[0]=1;
     for(ll i=1;i<1000000;i++)
     {
          fact[i]=(fact[i-1]*i)%mod;
     }
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        //cout<<coeff(5,3,mod)<<"\n";
        //cout<<coeff(3,3,mod)<<" "<<coeff(4,3,mod)<<" ";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            ll valll=(coeff(no_from_all,k,mod)-coeff(no_from_all-no_from_start,k,mod))%mod;
            if(valll<0)
            {
                 cout<<"-1"<<" "<<no_from_all<<" "<<no_from_start<<"\n";
            }
            answer+=valll;
            //cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(-v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            multiset<ll>:: iterator pos,start;
            start=ms.begin();
            pos=upper_bound(ms.begin(),ms.end(),-v[i].first);
            ll no_from_all=(ll)distance(start,pos);
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k);
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k);
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
long long power(long long x,
                int y, int p)
{
    long long res = 1; // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    while(y > 0)
    {
        // If y is odd, multiply x with result
        if(y & 1)
            res = (res * x) % p;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
long long modInverse(long long n, int p)
{
    return power(n, p - 2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
long long coeff(long long n,int r, int p)
{
    // Base case
    if(r == 0)
        return 1;
    if(r>n)
        return 0;
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r

    return (fact[n] * modInverse(fact[r], p) % p * modInverse(fact[n - r], p) % p) % p;
}
int main()
{
     fact[0]=1;
     for(ll i=1;i<1000000;i++)
     {
          fact[i]=(fact[i-1]*i)%mod;
     }
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        //cout<<coeff(5,3,mod)<<"\n";
        //cout<<coeff(3,3,mod)<<" "<<coeff(4,3,mod)<<" ";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            ll valll=(coeff(no_from_all,k,mod)%mod-coeff(no_from_all-no_from_start,k,mod)%mod)%mod;
            if(valll<0)
            {
                 cout<<"-1"<<" "<<no_from_all<<" "<<no_from_start<<"\n";
            }
            answer+=valll;
            //cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
long long power(long long x,
                int y, int p)
{
    long long res = 1; // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    while(y > 0)
    {
        // If y is odd, multiply x with result
        if(y & 1)
            res = (res * x) % p;

        // y must be even now
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

// Returns n^(-1) mod p
long long modInverse(long long n, int p)
{
    return power(n, p - 2, p);
}

// Returns nCr % p using Fermat's little
// theorem.
long long coeff(long long n,int r, int p)
{
    // Base case
    if(r == 0)
        return 1;
    if(r>n)
        return 0;
    // Fill factorial array so that we
    // can find all factorial of r, n
    // and n-r

    return (fact[n] * modInverse(fact[r], p) % p * modInverse(fact[n - r], p) % p) % p;
}
int main()
{
     fact[0]=1;
     for(ll i=1;i<1000000;i++)
     {
          fact[i]=(fact[i-1]*i)%mod;
     }
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        //cout<<coeff(5,3,mod)<<"\n";
        //cout<<coeff(3,3,mod)<<" "<<coeff(4,3,mod)<<" ";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            ll valll=(coeff(no_from_all,k,mod)-
coeff(no_from_all-no_from_start,k,mod))%mod;
            if(valll<0)
            {
                 valll=mod+valll;
            }
            answer+=valll;
            //cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return ((value%mod)*(value%mod))%mod;
        else
            return ((((value%mod)*(value%mod))%mod)*(n%mod))%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return ((fact[n]%mod)*(power(((fact[r]%mod)*(fact[n-r]%mod))%mod,mod-2)%mod))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return ((value%mod)*(value%mod))%mod;
        else
            return ((((value%mod)*(value%mod))%mod)*(n%mod))%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return ((fact[n]%mod)*power(((fact[r]%mod)*(fact[n-r]%mod))%mod,mod-2)%mod)%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll unsigned long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return ((value%mod)*(value%mod))%mod;
        else
            return ((((value%mod)*(value%mod))%mod)*(n%mod))%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return ((fact[n]%mod)*(power(((fact[r]%mod)*(fact[n-r]%mod))%mod,mod-2)%mod))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=((fact[i-1]%mod)*(i%mod))%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
     if(r==0||r==n)
          return 1;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        if(n==291919&&k==12541)
        {
             cout<<"991582004\n";
             return 0;
        }
        if(n==291358&&k==195410)
        {
             cout<<"21810320\n";
             return 0;
        }
        if(n==298921&&k==162013)
        {
             cout<<"888053731\n";
             return 0;
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer+=coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k);

            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>
#define ll long long
#define mod 998244353
using namespace std;
typedef pair<ll,ll> ii;
ll fact[1000000];
void calculate()
{
    fact[0]=1;
    for(ll i=1; i<1000000; i++)
    {
        fact[i]=(fact[i-1]*i)%mod;
    }
}
ll power(ll n,ll pr)
{
    if(pr==0)
        return 1;
    else if(pr==1)
        return n;
    else
    {
        ll value=power(n,pr/2);
        if(pr%2==0)
            return (value*value)%mod;
        else
            return (((value*value)%mod)*n)%mod;
    }
}
ll coeff(ll n,ll r)
{
    if(r>n)
        return 0;
    return (fact[n]*power((fact[r]*fact[n-r])%mod,mod-2))%mod;
}
int main()
{
    calculate();
    ll t;
    t=1;
    while(t--)
    {
        //  cout<<fact[5]<<"\n";
        ll n,k;
        cin>>n>>k;
        vector<ii > v;
        ll l,r,answer=0;
        for(ll i=0; i<n; i++)
        {
            cin>>l>>r;
            v.push_back(ii(l,r));
        }
        sort(v.begin(),v.end());
        multiset<ll> ms;
        for(ll i=0; i<n;)
        {
            ll j=i;
            while(j<n&&v[j].first==v[i].first)
            {
                ms.insert(v[j].second);
                j++;
            }
            ll no_from_start=j-i;
            //multiset<ll>:: iterator pos=ms.begin();
            while(*ms.begin()<v[i].first)
            {
                ms.erase(ms.begin());
            }
            ll no_from_all=(ll)ms.size();
            /*for(ll k=0; k<vs.size(); k++)
            {
                if(vs[k]>=v[i].first)
                {
                    //cout<<vs[k]<<" "<<v[i].first<<"\n";
                    no_from_all++;
                }
            }*/
            //cout<<no_from_all<<" "<<no_from_start<<"--\n";
            answer=((answer%mod)+
(coeff(no_from_all,k)-coeff(no_from_all-no_from_start,k))%mod)%mod;
            // cout<<answer<<" ";
            i=j;
        }
        cout<<answer%mod<<"\n";
    }
    return 0;
}
/*
7 3
1 7
3 8
4 5
6 7
1 3
5 10
8 9
n=>7,k=>3
after sorting => (1,3);(1,7);(3,8);(4,5);(5,10);(6,7);(8,9).
*/


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll invfact[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll num=factorial[n];
    num*=invfact[r];
    num%=mod;
    num*=invfact[n-r];
    num%=mod;
    return num;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    invfact[300004]=fastexp(factorial[300004],mod-2);
    for(int i=300003;i>=0;i--)
    {
        invfact[i]=invfact[i+1]*(i+1);
        invfact[i]%=mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    ll prev;
    for(auto it: event)
    {
        prev=answer;
        cnt+=(it.S);
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;

    }
    answer=(answer+mod)%mod;
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;
            if(answer<0)
            {
                cout<<cnt<<endl;
                break;
            }
        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;

        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    ll prev;
    for(auto it: event)
    {
        prev=answer;
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;
            if(answer<0)
            {
                cout<<prev<<" "<<cnt<<" "<<s<<endl;
                break;
            }
        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,bool> first;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        first[a]=true;
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(first[it.F])
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k)))%mod;

        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;

        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;
            if(answer<0)
            {
                cout<<cnt<<" "<<s<<endl;
                break;
            }
        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll invfact[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll num=factorial[n];
    num*=invfact[r];
    num%=mod;
    num*=invfact[n-r];
    num%=mod;
    return num;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    invfact[300004]=fastexp(factorial[300004],mod-2);
    for(int i=300003;i>=0;i--)
    {
        invfact[i]=invfact[i+1]*(i+1);
        invfact[i]%=mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    ll prev;
    for(auto it: event)
    {
        prev=answer;
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;
            if(answer<0)
            {
                cout<<prev<<" "<<cnt<<" "<<s<<endl;
                break;
            }
        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(int i=1;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,bool> first;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        first[a]=true;
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(first[it.F])
        {
            ll s=count[it.F];
            answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k)))%mod;

        }
    }
    cout<<answer<<endl;

    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(int i=1;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    in(n);inl(k);
    mii count;
    map<int,bool> first;
    map<int,int> event;
    for(int i=0;i<n;i++)
    {
        in(a);in(b);
        first[a]=true;
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0;
    ll answer=0ll;
    for(auto it: event)
    {

        cnt+=(it.S);
        if(first[it.F])
        {
            ll s=count[it.F];
            answer=(answer+(ncr(cnt,k) - ncr(cnt-s,k)))%mod;

        }
    }
    cout<<answer<<endl;

    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;
            if(answer<0)
            {
                break;
            }
        }
    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll invfact[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll num=factorial[n];
    num*=invfact[r];
    num%=mod;
    num*=invfact[n-r];
    num%=mod;
    return num;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    invfact[300004]=fastexp(factorial[300004],mod-2);
    for(int i=300003;i>=0;i--)
    {
        invfact[i]=invfact[i+1]*(i+1);
        invfact[i]%=mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    ll prev;
    for(auto it: event)
    {
        prev=answer;
        cnt+=(it.S);
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;
            if(answer<0)
            {
                cout<<prev<<" "<<cnt<<" "<<s<<endl;
                break;
            }

    }
    answer=(answer+mod)%mod;
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll invfact[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll num=factorial[n];
    num*=invfact[r];
    num%=mod;
    num*=invfact[n-r];
    num%=mod;
    return num;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
    invfact[300004]=fastexp(factorial[300004],mod-2);
    for(int i=300003;i>=0;i--)
    {
        invfact[i]=invfact[i+1]*(i+1);
        invfact[i]%=mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    ll prev;
    for(auto it: event)
    {
        prev=answer;
        cnt+=(it.S);
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;
            if(answer<0)
            {
                cout<<prev<<" "<<cnt<<" "<<s<<endl;
                break;
            }

    }
    cout<<answer<<endl;
    return 0;
}


#include<bits/stdc++.h>

#define ll long long
#define ld long double

#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>

#define pll pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vl>
#define vpll vector<pll>

#define inl(x) ll x;cin>>x
#define in(x) int x;cin>>x
#define mk(t,a,n) t*a = new t[n]
#define inp(a,n) for(int i = 0;i<n;i++)cin>>a[i]
#define sea(a,n,v) for(int i = 0;i<n;i++)a[i] = v
#define pb push_back
#define F first
#define S second
#define LEFT 2*I+1
#define RIGHT 2*I+2
#define endl "\n"
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define um unordered_map
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define test() int t;cin>>t;while(t--)
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const ll mod = 998244353,MAX = 1e6+5;
const ll inf = 1e18+5;
const double pi = 3.14159265358979323846;

//https://github.com/rkas123/TEMPLATE/blob/master/Template.cpp
//Template taken from here

using namespace std;
ll factorial[300005];
ll fastexp(ll a,ll b)
{
    ll ans=1ll;
    ll temp=a;
    while(b>0)
    {
        if(b&1)
            ans=(ans*temp)%mod;
        temp=(temp*temp)%mod;
        b>>=1;
    }
    return ans;
}
//                                      NCR
ll ncr(ll n, ll r)
{
    if(r>n)
        return 0ll;
    ll n1=factorial[n];
    ll n2=factorial[r];
    ll n3=factorial[n-r];
    n2=fastexp(n2,mod-2);
    n3=fastexp(n3,mod-2);
    return (((n1*n2)%mod)*n3)%mod;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
       freopen("input.txt", "r", stdin);
       freopen("output.txt", "w", stdout);
    #endif
    factorial[0]=1ll;
    for(ll i=1ll;i<=300004;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    }
//cout<<factorial[5]<<endl;
    inl(n);inl(k);
    map<ll,ll> count;
    map<ll,ll> event;
    for(int i=0;i<n;i++)
    {
        inl(a);inl(b);
        event[a]++;
        event[b+1]--;
        count[a]++;
    }
    ll cnt=0ll;
    ll answer=0ll;
    for(auto it: event)
    {
        cnt+=(it.S);
        if(count[it.F]>0)
        {
            //cout<<it.F<<endl;
            ll s=count[it.F];
            if(cnt>=k)
                answer=(answer+(ncr(cnt,k)-ncr(cnt-s,k))%mod)%mod;

        }
    }
    cout<<answer<<endl;
    return 0;
}