import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q;
        int ans;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            ans = search(q);
            System.out.println(ans);
        }
        in.close();
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right ) {
            int mid = (right + left) >>> 1;

            if (mid < q)
                left = mid + 1;
            else if (mid > q)
                right = mid - 1;
            else
                return mid+1;
        }
        return (left + 1);

    }

}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q;
        int ans;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            ans = bs(q);
            System.out.println(ans);
        }
        in.close();
 //       Arrays.binarySearch(ans)
    }

    static int bs(int q)
    {
        int l = 0;
        int r = n;
        int ans=r;
        while(l<=r)
        {
            int mid=(l+r) >>>1 ;
            if(sum[mid]>=q)
            {
                ans=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        return ans;
    }

}


import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();
        int[] c = new int[n];
        sum = new int[n];
        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            summ += +c[i] * in.nextInt();
            sum[i] = summ;
        }
        int q;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            System.out.println(search(q));
        }
    }

    private static int search(int q) {
        int left = 0;
        int right = n;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = mid + 1;
            } else {
                right = mid;
            }
        }
        return left + 1;
    }

}


import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();
        int[] c = new int[n];
        sum = new int[n];
        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            summ += c[i] * in.nextInt();
            sum[i] = summ;
        }
        int q;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            System.out.println(search(q));
        }
    }

    private static int search(int q) {
        int left = 0;
        int right = n;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = mid + 1;
            } else {
                right = mid;
            }
        }
        return left + 1;
    }

}


import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();
        int[] c = new int[n];
        sum = new int[n];
        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            summ += c[i] * in.nextInt();
            sum[i] = summ;
        }
        int q;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            System.out.println(search(q));
        }
    }

    private static int search(int q) {
        int left = 0;
        int right = n;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = ++mid ;
            } else {
                right = mid;
            }
        }
        return ++left;
    }

}


import java.io.*;
import java.util.StringTokenizer;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        n = fs.nextInt();
        int m = fs.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = fs.nextInt();
            t[i] = fs.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = fs.nextInt();
            ans = search(q);
           System.out.println(ans);
        }
       // fs.close();
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = ++mid ;
            } else {
                right = mid;
            }
        }
        return ++left;
    }
    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }

}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            ans =  Arrays.binarySearch(sum,q);

            System.out.println(ans+1);
        }
        in.close();
    //    Arrays.binarySearch(sum,q);

 //       Arrays.binarySearch(ans)
    }

    static int bs(int q)
    {
        int l = 0;
        int r = n-1;
        int ans=r;
        while(l<=r)
        {
            int mid=(l+r) >>1 ;
            if(sum[mid]>=q)
            {
                ans=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        return ans;
    }

}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q;
        int ans;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            ans = search(q);
            System.out.println(ans);
        }
        in.close();
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right ) {
            int mid = (right + left) >>> 1;

            if (mid < q)
                left = mid + 1;
            else if (mid > q)
                right = mid - 1;
            else
                return mid;
        }
        return (left + 1);

    }

}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            ans =  Arrays.binarySearch(sum,q);
            if(ans<0){
                ans = -ans-1;
            }

            System.out.println(ans+1);
        }
        in.close();
    //    Arrays.binarySearch(sum,q);

 //       Arrays.binarySearch(ans)
    }

    static int bs(int q)
    {
        int l = 0;
        int r = n-1;
        int ans=r;
        while(l<=r)
        {
            int mid=(l+r) >>1 ;
            if(sum[mid]>=q)
            {
                ans=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        return ans;
    }

}


import java.io.*;
import java.util.StringTokenizer;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        n = fs.nextInt();
        int m = fs.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = fs.nextInt();
            t[i] = fs.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = fs.nextInt();
            ans = search(q);
            pw.println(ans+1);
        }
        fs.close();
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = ++mid ;
            } else {
                right = mid;
            }
        }
        return ++left;
    }
    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }

}


import java.io.*;
import java.util.StringTokenizer;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        n = fs.nextInt();
        int m = fs.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = fs.nextInt();
            t[i] = fs.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = fs.nextInt();
            ans = bs(q);
            pw.println(ans+1);
        }
        fs.close();
    }

    static int bs(int q) {
        int l = 0;
        int r = n - 1;
        int ans = 0;
        while (l <= r) {
            int mid = (l + r) >> 1;
            if (sum[mid] >= q) {
                ans = mid;
                r = mid - 1;
            } else l = mid + 1;
        }
        return ans;
    }
    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }

}


import java.util.*;
import java.io.*;

public class TaskD2 {
    static class Interval {
        int start, end;

        public Interval(int start, int end) {
            this.start = start;
            this.end = end;
        }

        @Override
        public String toString() {
            return "Interval{" +
                    "start=" + start +
                    ", end=" + end +
                    '}';
        }
    }

    public static void solve(FastReader fs, PrintWriter pw) {
        int n = fs.nextInt(), m = fs.nextInt();
        int s = 1;
        Interval[] intervals = new Interval[n];
        for (int i = 0; i < n; i++) {
            int a = fs.nextInt(), b = fs.nextInt();
            intervals[i] = new Interval(s, s + a * b);
            s += a * b;
        }
        for (int i = 0; i < m; i++) {
            int moment = fs.nextInt();
            int lo = 0, hi = n - 1;
            int ans = 0;
            while (lo <= hi) {
                int mid = lo + (hi - lo) / 2;
                if (moment >= intervals[mid].start && moment < intervals[mid].end) {
                    ans = mid;
                    break;
                }
                if (moment >= intervals[mid].end) {
                    lo = mid + 1;
                } else {
                    hi = mid - 1;
                }
            }
            pw.println(ans + 1);
        }
    }

    public static void main(String[] args) throws Exception {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));

        solve(fs, pw);

        fs.close();
        pw.close();
    }

    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }

}


import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();
        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];
        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            System.out.println(search(q));
        }
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = ++mid ;
            } else {
                right = mid;
            }
        }
        return ++left;
    }

}


import java.io.*;
import java.util.StringTokenizer;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        n = fs.nextInt();
        int m = fs.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = fs.nextInt();
            t[i] = fs.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = fs.nextInt();
            ans = search(q);
            pw.println(ans);
        }
        fs.close();
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = ++mid ;
            } else {
                right = mid;
            }
        }
        return ++left;
    }
    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }

}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q;
        int ans;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            ans = search(q);
            System.out.println(ans);
        }
        in.close();
 //       Arrays.binarySearch(ans)
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right ) {
            int mid = (right + left) >>> 1;

            if (sum[mid] < q)
                left = mid + 1;
            else if (mid > q)
                right = mid - 1;
            else
                return mid;
        }
        return (left + 1);

    }

}


import java.io.*;
import java.util.StringTokenizer;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        TaskD2.FastReader fs = new TaskD2.FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        n = fs.nextInt();
        int m = fs.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = fs.nextInt();
            t[i] = fs.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = fs.nextInt();
            ans = bs(q);
            pw.println(ans+1);
        }
        fs.close();
    }

    static int bs(int q) {
        int l = 0;
        int r = n - 1;
        int ans = 0;
        while (l <= r) {
            int mid = (l + r) >> 1;
            if (sum[mid] >= q) {
                ans = mid;
                r = mid - 1;
            } else l = mid + 1;
        }
        return ans;
    }
    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }

}


import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();
        int[] c = new int[n];
        sum = new int[n];
        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            summ += c[i] * in.nextInt();
            sum[i] = summ;
        }
        int q;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            System.out.println(search(q));
        }
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = ++mid ;
            } else {
                right = mid;
            }
        }
        return ++left;
    }

}


import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int m = in.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = in.nextInt();
            t[i] = in.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q;
        int ans;
        for (int i = 0; i < m; i++) {
            q = in.nextInt();
            ans = bs(q);
            System.out.println(ans+1);
        }
        in.close();
 //       Arrays.binarySearch(ans)
    }

    static int bs(int q)
    {
        int l = 0;
        int r = n-1;
        int ans=r;
        while(l<=r)
        {
            int mid=(l+r) >>1 ;
            if(sum[mid]>=q)
            {
                ans=mid;
                r=mid-1;
            }
            else l=mid+1;
        }
        return ans;
    }

}


import java.io.*;
import java.util.StringTokenizer;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        FastReader fs = new FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        n = fs.nextInt();
        int m = fs.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = fs.nextInt();
            t[i] = fs.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = fs.nextInt();
            ans = search(q);
            pw.print(ans);
        }
       // fs.close();
    }

    private static int search(int q) {
        int left = 0;
        int right = n-1;
        while (left < right) {
            int mid = (right + left) >> 1;
            if (sum[mid] < q) {
                left = ++mid ;
            } else {
                right = mid;
            }
        }
        return ++left;
    }
    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }

}


import java.io.*;
import java.util.StringTokenizer;

public class TaskD {
    static int n;
    static int[] sum;

    public static void main(String[] args) {
        TaskD2.FastReader fs = new TaskD2.FastReader(System.in);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
        n = fs.nextInt();
        int m = fs.nextInt();

        int[] c = new int[n];
        int[] t = new int[n];
        sum = new int[n];

        int summ = 0;
        for (int i = 0; i < n; i++) {
            c[i] = fs.nextInt();
            t[i] = fs.nextInt();
            summ += c[i] * t[i];
            sum[i] = summ;
        }
        int q=0;
        int ans;
        for (int i = 0; i < m; i++) {
            q = fs.nextInt();
            ans = bs(q);
            pw.println(ans+1);
        }
        fs.close();
    }

    static int bs(int q) {
        int l = 0;
        int r = n - 1;
        int ans = 0;
        while (l <= r) {
            int mid = (l + r) >> 1;
            if (sum[mid] >= q) {
                ans = mid;
                r = mid - 1;
            } else l = mid + 1;
        }
        return ans;
    }
    static class FastReader {

        BufferedReader reader;
        StringTokenizer st;

        FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            st = null;
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String line = reader.readLine();
                    if (line == null) {
                        return null;
                    }
                    st = new StringTokenizer(line);
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = null;
            try {
                s = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return next().charAt(0);
        }

        int[] nextIntArray(int n) {
            int[] arr = new int[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArray(int n) {
            long[] arr = new long[n];
            int i = 0;
            while (i < n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        int[] nextIntArrayOneBased(int n) {
            int[] arr = new int[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextInt();
            }
            return arr;
        }

        long[] nextLongArrayOneBased(int n) {
            long[] arr = new long[n + 1];
            int i = 1;
            while (i <= n) {
                arr[i++] = nextLong();
            }
            return arr;
        }

        void close() {
            try {
                reader.close();
            } catch (IOException e) {
                System.err.println("There's been an error trying closing the reader ");
                e.printStackTrace();
            }
        }
    }
}


import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
    Main() { super(System.out); }
    Scanner scanner = new Scanner(System.in);
    public static void main(String[] $) {
        Main o = new Main(); o.main(); o.flush();
    }

    void main() {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        long [] timeAtI= new long[n];
        long totalTime=0;
        for (int i=0;i<n;i++){
            int ci = scanner.nextInt();
            int ti = scanner.nextInt();
            totalTime+=(ci*ti);
            timeAtI[i]=totalTime;
        }
        int currIndex=0;
        long currNumber=timeAtI[currIndex];
        for (int i=0;i<m;i++){
            long vi=scanner.nextInt();
            while(currNumber<vi){
                currIndex++;
                currNumber=timeAtI[currIndex];
            }
            System.out.println(currIndex+1);
        }
    }
}


import java.lang.*;
import java.util.*;

public class Main {
    public static void main (String[]args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] aa = new int[n];
        for (int i = 0; i < n; i++) {
            int c = sc.nextInt();
            int t = sc.nextInt();
            aa[i] = c * t;
        }
        int a = 0;
        for (int i = 0, j = 0; j < m; j++) {
            int b = sc.nextInt();
            while (i < n && a + aa[i] < b)
                a += aa[i++];
            System.out.println(i + 1);
        }

    }
}


import java.lang.*;
import java.util.*;

public class Main {
    public static void main (String[]args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int [] timeAtI= new int[n];
        long totalTime=0;
        for (int i=0;i<n;i++){
            int ci = scanner.nextInt();
            int ti = scanner.nextInt();
            timeAtI[i]=ci*ti;
        }
        int currIndex=-1;
        for (int i=0;i<m;i++){
            long vi=scanner.nextInt();
            while(totalTime<vi){
                currIndex++;
                totalTime+=timeAtI[currIndex];
            }
            System.out.println(currIndex+1);
        }

    }
}


import java.io.*;
import java.util.*;

public class CF302B extends PrintWriter {
    CF302B() { super(System.out); }
    Scanner sc = new Scanner(System.in);
    public static void main(String[] $) {
        CF302B o = new CF302B(); o.main(); o.flush();
    }

    void main() {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] aa = new int[n];
        for (int i = 0; i < n; i++) {
            int c = sc.nextInt();
            int t = sc.nextInt();
            aa[i] = c * t;
        }
        int a = 0;
        for (int i = 0, j = 0; j < m; j++) {
            int b = sc.nextInt();
            while (i < n && a + aa[i] < b)
                a += aa[i++];
            println(i + 1);
        }
    }
}


import java.lang.*;
import java.util.*;

public class Main {
    public static void main (String[]args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int [] timeAtI= new int[n];
        int totalTime=0;
        for (int i=0;i<n;i++){
            int ci = scanner.nextInt();
            int ti = scanner.nextInt();
            timeAtI[i]=ci*ti;
        }
        int currIndex=-1;
        for (int i=0;i<m;i++){
            int vi=scanner.nextInt();
            while(totalTime<vi){
                currIndex++;
                totalTime+=timeAtI[currIndex];
            }
            System.out.println(currIndex+1);
        }

    }
}


import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
    Main() { super(System.out); }
    Scanner scanner = new Scanner(System.in);
    public static void main(String[] $) {
        Main o = new Main(); o.main(); o.flush();
    }

    void main() {
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int [] timeAtI= new int[n];
        int totalTime=0;
        for (int i=0;i<n;i++){
            int ci = scanner.nextInt();
            int ti = scanner.nextInt();
            timeAtI[i]=ci*ti;
        }
        int currIndex=-1;
        for (int i=0;i<m;i++){
            int vi=scanner.nextInt();
            while(totalTime<vi){
                currIndex++;
                totalTime+=timeAtI[currIndex];
            }
            System.out.println(currIndex+1);
        }
    }
}


/**
 * Author: Rohan Arora(codiinggeek)
 */

import java.io.*;
import java.util.*;

public class chad {
    static long mod = (long) Math.pow(10, 9) + 7;

    public static long binary(long val, ArrayList<Long> list){
        long ans = -1;
        int low = 0;
        int high = list.size()-1;
        while(low<=high){
            int mid = low+(high-low)/2;
            if(list.get(mid)>=val){
                ans = mid;
                high = mid-1;
            }else{
                low = mid+1;
            }
        }
        return ans+1;
    }
    public static void main(String[] args) {
        try {
            FastReader s = new FastReader();
            int n = s.nextInt();
            int m = s.nextInt();
            StringBuilder sb = new StringBuilder();
            ArrayList<Long> list = new ArrayList<>();
            long prev = 0;
            while(n-->0){
                long c = s.nextLong();
                long t = s.nextLong();
                prev += c*t;
                list.add(prev);
            }
            while(m-->0){
                long a = s.nextLong();
                long ans = binary(a, list);
                sb.append(ans+"\n");
            }
            System.out.println(sb);
        } catch (Exception e) {
            System.out.println(e);
            return;
        }
    }

    /**POWER CALCULATION FOR LARGE VALUES*/
    static long expo(long b, long ex) {
        long t = 1L;
        while (ex > 0) {

            if (ex % 2 != 0)
                t = (t * b) % mod;

            b = (b * b) % mod;
            ex /= 2;
        }
        return t % mod;
    }

    /**Pair class */
    class Pair<U, V> {
        U first;
        V second;

        Pair(U a, V b) {
            first = a;
            second = b;
        }
    }
/**---------------------------------------------------------------------------------*/
    /** FAST I/O */
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.*;
import java.lang.*;

public class Main{
    public static void main (String...args) throws IOException {
        Scanner in = new Scanner(System.in);
        BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = in.nextInt(), m= in.nextInt(); int[] song = new int[n]; int len =0;
        for(int i = 0; i<n; i++){
            int c = in.nextInt(), t = in.nextInt();
            song[i] = c*t;
        }
        for(int i =0, j=0; j<m;j++) {
            int time = in.nextInt();
            while (i < n && time > len + song[i]) time += song[i++];
            log.write((i + 1) + "\n");
        }
        log.close();
    }
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.*;
import java.lang.*;

public class Main{
    public static void main (String...args) throws IOException {
        Scanner in = new Scanner(System.in);
        BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = in.nextInt(), m= in.nextInt(); int[] song = new int[n]; int len =0;
        for(int i = 0; i<n; i++){
            int c = in.nextInt(), t = in.nextInt();
            song[i] = c*t;
        }
        for(int i =0, j=0; j<m;j++) {
            int time = in.nextInt();
            while (i < n && time > len + song[i]) time += song[i++];
            int ans = i+1;
            log.write(ans + "\n");
        }
        log.close();
    }
}