#include<stdio.h>
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,m,s,i,a,b;
  while(scanf("%d %d",&n,&m),n){
    int d[20]={0};
    for(s=0;n--;d[b]+=a)scanf("%d %d",&a,&b);
    for(i=10;i>-1;i--){
      s+=d[i]*i;
      s-=MIN(d[i],m)*i;
      m-=MIN(d[i],m);
    }
    printf("%d\n",s);
  }
  return 0;
}